<template>
	<view class="collection_deta">
		<Navbar>藏品详情</Navbar>
		<scroll-view scroll-y class="scroll_view">
			<view>
				<view class="banner">
					<view class="show_view">
						<image :src="cover" class="cover"></image>
					</view>
				</view>
				<view class="content">
					<view class="info">
						<view class="price">
							<view class="key">￥</view>
							<view class="value">{{price}}</view>
						</view>
						<view class="name">【{{name}}】</view>
						<view class="label">
							<view>发行：{{issue_all}}份</view>
							<view>流通：???份</view>
						</view>
					</view>
					<view class="sub_title">
						<image :src="`${baseImageUrl}/home/xs2.png`"></image>
						<text>藏品介绍</text>
					</view>
					<view class="u_parse">
						<u-parse :content="content" :previewImg="false"></u-parse>
					</view>
					<view class="sub_title">
						<image :src="`${baseImageUrl}/home/xs2.png`"></image>
						<text>购买须知</text>
					</view>
					<view class="u_parse">
						<u-parse :content="content" :previewImg="false"></u-parse>
					</view>
				</view>
			</view>
		</scroll-view>
		<view class="footer">
			<view class="price">
				<text class="key">¥</text>
				<text class="value">{{price}}</text>
			</view>
			<!-- <view class="btn not">未开始</view> -->
			<view class="btn" @click="open(1)">立即购买</view>
			<!-- <view class="btn not">已结束</view>	 -->
		</view>

		<u-popup :show="popup_show" bgColor="transparent" mode="center" @close="close">
			<CollectionListTwo :id="id" @close="close" />
		</u-popup>
	</view>
</template>

<script>
	import {
		productInfo
	} from '@/request/api.js';
	import CollectionListTwo from '@/components/home/CollectionListTwo.vue';
	export default {
		components: {
			CollectionListTwo
		},
		data() {
			return {
				id: null,
				cover: "",
				price: "",
				name: "",
				issue_all: "",
				content: "",

				popup_show: false,
				popup: 1
			}
		},
		onLoad(option) {
			this.id = option.id;
			this.getDeta();
		},
		onHide() {
			this.popup_show = false;
		},
		methods: {
			async getDeta() {
				let {
					info
				} = await productInfo({
					id: this.id
				});
				this.cover = info.cover;
				this.price = info.price;
				this.name = info.name;
				this.issue_all = info.issue_all;
				this.content = info.content;
			},
			open(index) {
				this.popup = index;
				this.popup_show = true;
			},
			close() {
				this.popup_show = false;
			}
		}
	}
</script>

<style scoped lang="scss">
	* {
		font-family: LiSu;
	}

	$footerHeight: 157rpx;

	.collection_deta {
		height: 100vh;
		background: #29170D;

		.scroll_view {
			height: calc(100vh - #{$navbarHeight} - #{$footerHeight});

			.banner {
				width: 100%;
				height: 730rpx;
				padding: 80rpx 75rpx 50rpx;
				box-sizing: border-box;
				background: url(#{$baseImageUrl}/home/i2.png) no-repeat;
				background-size: 100% 100%;

				.show_view {
					width: 100%;
					height: 100%;
					position: relative;

					.cover {
						width: 100%;
						height: 100%;
					}
				}

			}

			.content {
				padding: 0 30rpx;
				box-sizing: border-box;

				.info {
					width: 100%;
					height: 240rpx;
					padding: 30rpx 0 30rpx 34rpx;
					box-sizing: border-box;
					background: url(#{$baseImageUrl}/bg/688_238.png) no-repeat;
					background-size: 100% 100%;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.price {
						display: flex;
						align-items: center;
						color: #494338;
						font-weight: 400;
						font-family: LiSu;

						.key {
							font-size: 30rpx;

						}

						.value {
							font-size: 50rpx;
						}
					}

					.name {
						color: #494338;
						font-size: 50rpx;
						font-weight: 400;
						font-family: LiSu;
					}

					.label {
						display: flex;

						view {
							width: 246rpx;
							height: 44rpx;
							line-height: 44rpx;
							text-align: center;
							color: #FFFFFF;
							font-size: 28rpx;
							font-weight: 400;
							font-family: LiSu;
							background: url(#{$baseImageUrl}/common/label2.png) no-repeat;
							background-size: 100% 100%;
						}
					}
				}

				.sub_title {
					height: 98rpx;
					display: flex;
					align-items: center;

					image {
						width: 32rpx;
						height: 32rpx;
					}

					text {
						color: #FFFFFF;
						font-size: 32rpx;
						font-family: SimSun;
						font-weight: 400;
						padding-left: 12rpx;
						box-sizing: border-box;
					}
				}

				.u_parse {
					color: #fff;
					font-family: SimSun;
				}
			}
		}

		.footer {
			width: 100%;
			height: $footerHeight;
			background: #29170D;
			border-top: 2px solid #BC8478;
			padding: 14rpx 30rpx;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;

			.price {
				color: #FFFFFF;
				font-weight: 400;
				font-family: SimSun;

				.key {
					font-size: 28rpx;
				}

				.value {
					font-size: 40rpx;
				}
			}

			.btn {
				width: 210rpx;
				height: 80rpx;
				line-height: 80rpx;
				text-align: center;
				color: #FFFFFF;
				font-size: 30rpx;
				font-weight: 400;
				font-family: SimSun;
				background: url(#{$baseImageUrl}/common/btn.png) no-repeat;
				background-size: 100% 100%;

				&.not {
					background: url(#{$baseImageUrl}/common/btn2.png) no-repeat;
					background-size: 100% 100%;
				}
			}
		}
	}
</style>